package com.fqgj.sentry.policy.engine.utils;

import java.util.Iterator;
import java.util.Map;
import java.util.Properties;

/**
 * Created by kennykong on 2017/7/18.
 */
public class SystemFile {
    public static void main(String[] args) {
        Map<String, String> map = System.getenv();
        for (Iterator<String> itr = map.keySet().iterator(); itr.hasNext(); ) {
            String key = itr.next();
            System.out.println(key + "=" + map.get(key));
        }

        Properties prop = System.getProperties();
        Iterator<Map.Entry<Object, Object>> it = prop.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<Object, Object> entry = it.next();
            Object key = entry.getKey();
            Object value = entry.getValue();
            System.out.println(key+"="+value);
        }

        String path = SystemFile.class.getResource("/").toString();
        System.out.println("path = " + path);

        String path2 = Thread.currentThread().getContextClassLoader().getResource("/").getPath();
        System.out.println("path2 = " + path2);
    }
}